using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using System.Text;
using ECommerce.DAL;


namespace Entity
{


    /// <summary>
    /// This object represents the Private Fields of TblRawData.
    /// </summary>

    [System.ComponentModel.DataObject]
    public class TblRawData : DatabaseUtility
    {
        #region TblRawData Private Fields


        Int32 _rawDataId;
        String _itemNumber = String.Empty;
        Int32 _qTYOnHand;
        String _itemDescription = String.Empty;
        Decimal _currentCost;
        Decimal _standardCost;
        String _manufacturer = String.Empty;
        Decimal _priceLevel;
        Int32 _pkgQuanity;
        String _sellingUOfM = String.Empty;
        String _itemClassCode = String.Empty;
        Int32 _qTYAllocated;
        Int32 _qTYAvailable;
        Int32 _qTYOnOrder;
        String _itemGenericDescription = String.Empty;
        Decimal _itemWeight;
        String _itemShortName = String.Empty;
        Boolean _isInserted;
        Int32 _widthWholeNumberFirstDigit;
        Int32 _widthWholeNumberSecondDigit;
        Int32 _widthFractionNumberFirstDigit;
        Int32 _widthFractionNumberSecondDigit;
        Int32 _diameterWholeNumberFirstDigit;
        Int32 _diameterWholeNumberSecondDigit;
        Int32 _diameterFractionNumberFirstDigit;
        Int32 _diameterFractionNumberSecondDigit;
        Int32 _threadCountWholeNumberFirstDigit;
        Int32 _threadCountWholeNumberSecondDigit;
        Int32 _threadCountFractionNumberFirstDigit;
        Int32 _threadCountFractionNumberSecondDigit;
        Int32 _lengthWholeNumberFirstDigit;
        Int32 _lengthWholeNumberSecondDigit;
        Int32 _lengthFractionNumberFirstDigit;
        Int32 _lengthFractionNumberSecondDigit;
        String _subCat1 = String.Empty;
        String _defaultOrder = String.Empty;

        #endregion
        #region TblRawData Constractor
        /// <summary>
        /// Creates an empty object of TblRawData. 
        /// This is mainly used to create a new instance of TblRawData to add a new TblRawData.
        /// </summary>
        public TblRawData() { }


        /// <summary>
        /// Used to retrieve employee information from database, 
        /// which is also used by Update method to save information of an existing TblRawData.
        /// </summary>
        public TblRawData
        (
            Int32 rawDataId,
            String itemNumber,
            Int32 qTYOnHand,
            String itemDescription,
            Decimal currentCost,
            Decimal standardCost,
            String manufacturer,
            Decimal priceLevel,
            Int32 pkgQuanity,
            String sellingUOfM,
            String itemClassCode,
            Int32 qTYAllocated,
            Int32 qTYAvailable,
            Int32 qTYOnOrder,
            String itemGenericDescription,
            Decimal itemWeight,
            String itemShortName,
            Boolean isInserted,
            Int32 widthWholeNumberFirstDigit,
            Int32 widthWholeNumberSecondDigit,
            Int32 widthFractionNumberFirstDigit,
            Int32 widthFractionNumberSecondDigit,
            Int32 diameterWholeNumberFirstDigit,
            Int32 diameterWholeNumberSecondDigit,
            Int32 diameterFractionNumberFirstDigit,
            Int32 diameterFractionNumberSecondDigit,
            Int32 threadCountWholeNumberFirstDigit,
            Int32 threadCountWholeNumberSecondDigit,
            Int32 threadCountFractionNumberFirstDigit,
            Int32 threadCountFractionNumberSecondDigit,
            Int32 lengthWholeNumberFirstDigit,
            Int32 lengthWholeNumberSecondDigit,
            Int32 lengthFractionNumberFirstDigit,
            Int32 lengthFractionNumberSecondDigit,
            String subCat1,
            String defaultOrder
        )
        {
            _rawDataId = rawDataId;
            _itemNumber = itemNumber;
            _qTYOnHand = qTYOnHand;
            _itemDescription = itemDescription;
            _currentCost = currentCost;
            _standardCost = standardCost;
            _manufacturer = manufacturer;
            _priceLevel = priceLevel;
            _pkgQuanity = pkgQuanity;
            _sellingUOfM = sellingUOfM;
            _itemClassCode = itemClassCode;
            _qTYAllocated = qTYAllocated;
            _qTYAvailable = qTYAvailable;
            _qTYOnOrder = qTYOnOrder;
            _itemGenericDescription = itemGenericDescription;
            _itemWeight = itemWeight;
            _itemShortName = itemShortName;
            _isInserted = isInserted;
            _widthWholeNumberFirstDigit = widthWholeNumberFirstDigit;
            _widthWholeNumberSecondDigit = widthWholeNumberSecondDigit;
            _widthFractionNumberFirstDigit = widthFractionNumberFirstDigit;
            _widthFractionNumberSecondDigit = widthFractionNumberSecondDigit;
            _diameterWholeNumberFirstDigit = diameterWholeNumberFirstDigit;
            _diameterWholeNumberSecondDigit = diameterWholeNumberSecondDigit;
            _diameterFractionNumberFirstDigit = diameterFractionNumberFirstDigit;
            _diameterFractionNumberSecondDigit = diameterFractionNumberSecondDigit;
            _threadCountWholeNumberFirstDigit = threadCountWholeNumberFirstDigit;
            _threadCountWholeNumberSecondDigit = threadCountWholeNumberSecondDigit;
            _threadCountFractionNumberFirstDigit = threadCountFractionNumberFirstDigit;
            _threadCountFractionNumberSecondDigit = threadCountFractionNumberSecondDigit;
            _lengthWholeNumberFirstDigit = lengthWholeNumberFirstDigit;
            _lengthWholeNumberSecondDigit = lengthWholeNumberSecondDigit;
            _lengthFractionNumberFirstDigit = lengthFractionNumberFirstDigit;
            _lengthFractionNumberSecondDigit = lengthFractionNumberSecondDigit;
            _subCat1 = subCat1;
            _defaultOrder = defaultOrder;
        }

        #endregion
        #region TblRawData Properties

        /***********************************************************************************************
                                    -- PROPERTIES --        
         Contains all the properties representing the data fields of the current entity.
         ***********************************************************************************************/

        /// <summary>
        /// This is the Primary key value of the RawDataId, which can't be assigned from the application,
        /// to ensure the data consistancy, by not letting the user to change the PK_TblRawData to update the data of an another TblRawData instance.
        /// For view or updation purpose, every TblRawData will be retrieved thru the proper 'Get' method.
        /// </summary>

        public Int32 RawDataId
        {
            get { return _rawDataId; }
        }


        public String ItemNumber
        {
            get { return _itemNumber; }
            set { _itemNumber = value; }
        }

        public Int32 QTYOnHand
        {
            get { return _qTYOnHand; }
            set { _qTYOnHand = value; }
        }

        public String ItemDescription
        {
            get { return _itemDescription; }
            set { _itemDescription = value; }
        }

        public Decimal CurrentCost
        {
            get { return _currentCost; }
            set { _currentCost = value; }
        }

        public Decimal StandardCost
        {
            get { return _standardCost; }
            set { _standardCost = value; }
        }

        public String Manufacturer
        {
            get { return _manufacturer; }
            set { _manufacturer = value; }
        }

        public Decimal PriceLevel
        {
            get { return _priceLevel; }
            set { _priceLevel = value; }
        }

        public Int32 PkgQuanity
        {
            get { return _pkgQuanity; }
            set { _pkgQuanity = value; }
        }

        public String SellingUOfM
        {
            get { return _sellingUOfM; }
            set { _sellingUOfM = value; }
        }

        public String ItemClassCode
        {
            get { return _itemClassCode; }
            set { _itemClassCode = value; }
        }

        public Int32 QTYAllocated
        {
            get { return _qTYAllocated; }
            set { _qTYAllocated = value; }
        }

        public Int32 QTYAvailable
        {
            get { return _qTYAvailable; }
            set { _qTYAvailable = value; }
        }

        public Int32 QTYOnOrder
        {
            get { return _qTYOnOrder; }
            set { _qTYOnOrder = value; }
        }

        public String ItemGenericDescription
        {
            get { return _itemGenericDescription; }
            set { _itemGenericDescription = value; }
        }

        public Decimal ItemWeight
        {
            get { return _itemWeight; }
            set { _itemWeight = value; }
        }

        public String ItemShortName
        {
            get { return _itemShortName; }
            set { _itemShortName = value; }
        }

        public Boolean IsInserted
        {
            get { return _isInserted; }
            set { _isInserted = value; }
        }

        public Int32 WidthWholeNumberFirstDigit
        {
            get { return _widthWholeNumberFirstDigit; }
            set { _widthWholeNumberFirstDigit = value; }
        }

        public Int32 WidthWholeNumberSecondDigit
        {
            get { return _widthWholeNumberSecondDigit; }
            set { _widthWholeNumberSecondDigit = value; }
        }

        public Int32 WidthFractionNumberFirstDigit
        {
            get { return _widthFractionNumberFirstDigit; }
            set { _widthFractionNumberFirstDigit = value; }
        }

        public Int32 WidthFractionNumberSecondDigit
        {
            get { return _widthFractionNumberSecondDigit; }
            set { _widthFractionNumberSecondDigit = value; }
        }

        public Int32 DiameterWholeNumberFirstDigit
        {
            get { return _diameterWholeNumberFirstDigit; }
            set { _diameterWholeNumberFirstDigit = value; }
        }

        public Int32 DiameterWholeNumberSecondDigit
        {
            get { return _diameterWholeNumberSecondDigit; }
            set { _diameterWholeNumberSecondDigit = value; }
        }

        public Int32 DiameterFractionNumberFirstDigit
        {
            get { return _diameterFractionNumberFirstDigit; }
            set { _diameterFractionNumberFirstDigit = value; }
        }

        public Int32 DiameterFractionNumberSecondDigit
        {
            get { return _diameterFractionNumberSecondDigit; }
            set { _diameterFractionNumberSecondDigit = value; }
        }

        public Int32 ThreadCountWholeNumberFirstDigit
        {
            get { return _threadCountWholeNumberFirstDigit; }
            set { _threadCountWholeNumberFirstDigit = value; }
        }

        public Int32 ThreadCountWholeNumberSecondDigit
        {
            get { return _threadCountWholeNumberSecondDigit; }
            set { _threadCountWholeNumberSecondDigit = value; }
        }

        public Int32 ThreadCountFractionNumberFirstDigit
        {
            get { return _threadCountFractionNumberFirstDigit; }
            set { _threadCountFractionNumberFirstDigit = value; }
        }

        public Int32 ThreadCountFractionNumberSecondDigit
        {
            get { return _threadCountFractionNumberSecondDigit; }
            set { _threadCountFractionNumberSecondDigit = value; }
        }

        public Int32 LengthWholeNumberFirstDigit
        {
            get { return _lengthWholeNumberFirstDigit; }
            set { _lengthWholeNumberFirstDigit = value; }
        }

        public Int32 LengthWholeNumberSecondDigit
        {
            get { return _lengthWholeNumberSecondDigit; }
            set { _lengthWholeNumberSecondDigit = value; }
        }

        public Int32 LengthFractionNumberFirstDigit
        {
            get { return _lengthFractionNumberFirstDigit; }
            set { _lengthFractionNumberFirstDigit = value; }
        }

        public Int32 LengthFractionNumberSecondDigit
        {
            get { return _lengthFractionNumberSecondDigit; }
            set { _lengthFractionNumberSecondDigit = value; }
        }

        public String SubCat1
        {
            get { return _subCat1; }
            set { _subCat1 = value; }
        }

        public String DefaultOrder
        {
            get { return _defaultOrder; }
            set { _defaultOrder = value; }
        }


        #endregion
        #region TblRawData Static Methods
        /************************************************************************************
                                    -- CREATE METHOD (STATIC) --
        *************************************************************************************/
        /************************* Architecure note:**********************************
        Note 1:
        This method is specially useful for the case, where we need to use Object Data Source controls.
        For ObjectDataSource/SqlDataSource controls, the insert/update metnod requires paramters methods, rather property based methods.
        However, there is still a way to pass property based objects as method parameter for data source controls, 
        but in that case we could not use Sql type, as view controls or asp parameter control can only contain few of primitive type.
        The main reason to remain the Sql Type in our object architecture is it is faster and contains better way for null value support.
        
        Note 2: 
        Non-primary key: it should be primitive type, as the asp paramter control (included in data source control) supports only primitive types.
        /*****************************************************************************/
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
        public static Int32 CreateNewTblRawData
        (
            String itemNumber,
            Int32 qTYOnHand,
            String itemDescription,
            Decimal currentCost,
            Decimal standardCost,
            String manufacturer,
            Decimal priceLevel,
            Int32 pkgQuanity,
            String sellingUOfM,
            String itemClassCode,
            Int32 qTYAllocated,
            Int32 qTYAvailable,
            Int32 qTYOnOrder,
            String itemGenericDescription,
            Decimal itemWeight,
            String itemShortName,
            Boolean isInserted,
            Int32 widthWholeNumberFirstDigit,
            Int32 widthWholeNumberSecondDigit,
            Int32 widthFractionNumberFirstDigit,
            Int32 widthFractionNumberSecondDigit,
            Int32 diameterWholeNumberFirstDigit,
            Int32 diameterWholeNumberSecondDigit,
            Int32 diameterFractionNumberFirstDigit,
            Int32 diameterFractionNumberSecondDigit,
            Int32 threadCountWholeNumberFirstDigit,
            Int32 threadCountWholeNumberSecondDigit,
            Int32 threadCountFractionNumberFirstDigit,
            Int32 threadCountFractionNumberSecondDigit,
            Int32 lengthWholeNumberFirstDigit,
            Int32 lengthWholeNumberSecondDigit,
            Int32 lengthFractionNumberFirstDigit,
            Int32 lengthFractionNumberSecondDigit,
            String subCat1,
            String defaultOrder
        )
        {
            //creating an empty TblRawData object
            TblRawData tblRawData = new TblRawData();
            tblRawData.ItemNumber = itemNumber;
            tblRawData.QTYOnHand = qTYOnHand;
            tblRawData.ItemDescription = itemDescription;
            tblRawData.CurrentCost = currentCost;
            tblRawData.StandardCost = standardCost;
            tblRawData.Manufacturer = manufacturer;
            tblRawData.PriceLevel = priceLevel;
            tblRawData.PkgQuanity = pkgQuanity;
            tblRawData.SellingUOfM = sellingUOfM;
            tblRawData.ItemClassCode = itemClassCode;
            tblRawData.QTYAllocated = qTYAllocated;
            tblRawData.QTYAvailable = qTYAvailable;
            tblRawData.QTYOnOrder = qTYOnOrder;
            tblRawData.ItemGenericDescription = itemGenericDescription;
            tblRawData.ItemWeight = itemWeight;
            tblRawData.ItemShortName = itemShortName;
            tblRawData.IsInserted = isInserted;
            tblRawData.WidthWholeNumberFirstDigit = widthWholeNumberFirstDigit;
            tblRawData.WidthWholeNumberSecondDigit = widthWholeNumberSecondDigit;
            tblRawData.WidthFractionNumberFirstDigit = widthFractionNumberFirstDigit;
            tblRawData.WidthFractionNumberSecondDigit = widthFractionNumberSecondDigit;
            tblRawData.DiameterWholeNumberFirstDigit = diameterWholeNumberFirstDigit;
            tblRawData.DiameterWholeNumberSecondDigit = diameterWholeNumberSecondDigit;
            tblRawData.DiameterFractionNumberFirstDigit = diameterFractionNumberFirstDigit;
            tblRawData.DiameterFractionNumberSecondDigit = diameterFractionNumberSecondDigit;
            tblRawData.ThreadCountWholeNumberFirstDigit = threadCountWholeNumberFirstDigit;
            tblRawData.ThreadCountWholeNumberSecondDigit = threadCountWholeNumberSecondDigit;
            tblRawData.ThreadCountFractionNumberFirstDigit = threadCountFractionNumberFirstDigit;
            tblRawData.ThreadCountFractionNumberSecondDigit = threadCountFractionNumberSecondDigit;
            tblRawData.LengthWholeNumberFirstDigit = lengthWholeNumberFirstDigit;
            tblRawData.LengthWholeNumberSecondDigit = lengthWholeNumberSecondDigit;
            tblRawData.LengthFractionNumberFirstDigit = lengthFractionNumberFirstDigit;
            tblRawData.LengthFractionNumberSecondDigit = lengthFractionNumberSecondDigit;
            tblRawData.SubCat1 = subCat1;
            tblRawData.DefaultOrder = defaultOrder;

            return TblRawData.CreateNewTblRawData(tblRawData);
        }

        /************************************************************************************
                 -- UPDATE METHODS (STATIC) --
        *************************************************************************************/

        /************************* Architecure note:**********************************
        Note 1:
        This method is specially useful for the case, where we need to use Object Data Source controls.
        For ObjectDataSource/SqlDataSource controls, the insert/update metnod requires paramters methods, rather property based methods.
        However, there is still a way to pass property based objects as method parameter for data source controls, 
        but in that case we could not use Sql type, as view controls or asp parameter control can only contain few of primitive type.
        The main reason to remain the Sql Type in our object architecture is it is faster and contains better way for null value support.
        
        Note 2: 
        There the two types of paramaters will be passed here.
         * a. Primary key paramater: it should be Sql type, as we will bind the primary key property for the view controls (form view, details view etc) as datakey.
         * b. Non-primary key: it should be primitive type, as the asp paramter control (included in data source control) supports only primitive types.
        /*****************************************************************************/

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
        public static bool UpdateTblRawData
        (
            Int32 rawDataId,
            String itemNumber,
            Int32 qTYOnHand,
            String itemDescription,
            Decimal currentCost,
            Decimal standardCost,
            String manufacturer,
            Decimal priceLevel,
            Int32 pkgQuanity,
            String sellingUOfM,
            String itemClassCode,
            Int32 qTYAllocated,
            Int32 qTYAvailable,
            Int32 qTYOnOrder,
            String itemGenericDescription,
            Decimal itemWeight,
            String itemShortName,
            Boolean isInserted,
            Int32 widthWholeNumberFirstDigit,
            Int32 widthWholeNumberSecondDigit,
            Int32 widthFractionNumberFirstDigit,
            Int32 widthFractionNumberSecondDigit,
            Int32 diameterWholeNumberFirstDigit,
            Int32 diameterWholeNumberSecondDigit,
            Int32 diameterFractionNumberFirstDigit,
            Int32 diameterFractionNumberSecondDigit,
            Int32 threadCountWholeNumberFirstDigit,
            Int32 threadCountWholeNumberSecondDigit,
            Int32 threadCountFractionNumberFirstDigit,
            Int32 threadCountFractionNumberSecondDigit,
            Int32 lengthWholeNumberFirstDigit,
            Int32 lengthWholeNumberSecondDigit,
            Int32 lengthFractionNumberFirstDigit,
            Int32 lengthFractionNumberSecondDigit,
            String subCat1,
            String defaultOrder
        )
        {
            TblRawData tblRawData = TblRawData.GetTblRawDataByRawDataId(rawDataId);

            tblRawData.ItemNumber = itemNumber;
            tblRawData.QTYOnHand = qTYOnHand;
            tblRawData.ItemDescription = itemDescription;
            tblRawData.CurrentCost = currentCost;
            tblRawData.StandardCost = standardCost;
            tblRawData.Manufacturer = manufacturer;
            tblRawData.PriceLevel = priceLevel;
            tblRawData.PkgQuanity = pkgQuanity;
            tblRawData.SellingUOfM = sellingUOfM;
            tblRawData.ItemClassCode = itemClassCode;
            tblRawData.QTYAllocated = qTYAllocated;
            tblRawData.QTYAvailable = qTYAvailable;
            tblRawData.QTYOnOrder = qTYOnOrder;
            tblRawData.ItemGenericDescription = itemGenericDescription;
            tblRawData.ItemWeight = itemWeight;
            tblRawData.ItemShortName = itemShortName;
            tblRawData.IsInserted = isInserted;
            tblRawData.WidthWholeNumberFirstDigit = widthWholeNumberFirstDigit;
            tblRawData.WidthWholeNumberSecondDigit = widthWholeNumberSecondDigit;
            tblRawData.WidthFractionNumberFirstDigit = widthFractionNumberFirstDigit;
            tblRawData.WidthFractionNumberSecondDigit = widthFractionNumberSecondDigit;
            tblRawData.DiameterWholeNumberFirstDigit = diameterWholeNumberFirstDigit;
            tblRawData.DiameterWholeNumberSecondDigit = diameterWholeNumberSecondDigit;
            tblRawData.DiameterFractionNumberFirstDigit = diameterFractionNumberFirstDigit;
            tblRawData.DiameterFractionNumberSecondDigit = diameterFractionNumberSecondDigit;
            tblRawData.ThreadCountWholeNumberFirstDigit = threadCountWholeNumberFirstDigit;
            tblRawData.ThreadCountWholeNumberSecondDigit = threadCountWholeNumberSecondDigit;
            tblRawData.ThreadCountFractionNumberFirstDigit = threadCountFractionNumberFirstDigit;
            tblRawData.ThreadCountFractionNumberSecondDigit = threadCountFractionNumberSecondDigit;
            tblRawData.LengthWholeNumberFirstDigit = lengthWholeNumberFirstDigit;
            tblRawData.LengthWholeNumberSecondDigit = lengthWholeNumberSecondDigit;
            tblRawData.LengthFractionNumberFirstDigit = lengthFractionNumberFirstDigit;
            tblRawData.LengthFractionNumberSecondDigit = lengthFractionNumberSecondDigit;
            tblRawData.SubCat1 = subCat1;
            tblRawData.DefaultOrder = defaultOrder;

            return TblRawData.UpdateTblRawData(tblRawData);
        }

        /************************************************************************************
                         -- DELETE METHODS --
        *************************************************************************************/
        /************************* Architecure note:**********************************
        We have used the employeeId parameter as SqlInt32, to bind the delete method with object data source and view control directly.
        ****************************************************************************/
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Update, true)]
        public static bool DeleteTblRawData
        (
            Int32 rawDataId
        )
        {
            //Validate Input
            if (rawDataId <= GetRawDataIdMinValue)
                throw (new ArgumentOutOfRangeException("rawDataId"));

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            AddParameterToSqlCmd(sqlCmd, "@RawDataId", SqlDbType.Int, 0, ParameterDirection.Input, rawDataId);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_DELETETBLRAWDATA);
            ExecuteScalarCmd(sqlCmd);
            int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
            return (returnValue == 0 ? false : true);

        }

        /// <summary>
        /// Deletes a set of employees from the database.
        /// </summary>
        public static bool DeleteTblRawDataList(System.Collections.Generic.List<Int32> rawDataIdListToDelete)
        {
            //Validate Input
            foreach (Int32 rawDataId in rawDataIdListToDelete)
                if (rawDataId <= GetRawDataIdMinValue)
                    throw (new ArgumentOutOfRangeException("rawDataId"));

            //performing deletion operation //

            string xmlString = FormatXMLForIdArray(rawDataIdListToDelete);

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            AddParameterToSqlCmd(sqlCmd, "@RawDataIdList", SqlDbType.Xml, xmlString.ToString().Length, ParameterDirection.Input, xmlString.ToString());
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_DELETETBLRAWDATALIST);
            ExecuteScalarCmd(sqlCmd);
            int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
            return (returnValue == rawDataIdListToDelete.Count ? true : false);
        }

        /************************************************************************************
                                 -- GET BY PRIMARY METHODS --
        *************************************************************************************/
        /************************* Architecure note:**********************************
        Retrives an Employee from database, based on it's primary key.
        To view or update an employee, everytime we must have to use this type of 'get' method, 
        since we don't have direct access to the Primary key value for assigning value.
        We have used the employeeId parameter as SqlInt32, to bind the delete method with object data source and view control directly.
        /*****************************************************************************/
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static TblRawData GetTblRawDataByRawDataId(Int32 rawDataId)
        {
            if (rawDataId <= GetRawDataIdMinValue)
                throw (new ArgumentOutOfRangeException("rawDataId"));

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@RawDataId", SqlDbType.Int, 0, ParameterDirection.Input, rawDataId);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_GETTBLRAWDATABYRAWDATAID);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblRawDataCollectionFromReader);
            CustomCollection<TblRawData> objCollection = ((CustomCollection<TblRawData>)ExecuteReaderCmd(sqlCmd, test));

            if (objCollection.Count > 0)
                return objCollection[0];
            else
                return null;
        }

        /************************************************************************************
                         -- GET BY FOREIGN KEY METHODS --
        *************************************************************************************/

        /************************************************************************************
                 -- GET ALL METHODS --
        *************************************************************************************/
        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static CustomCollection<TblRawData> GetAllTblRawData()
        {

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_GETALLTBLRAWDATA);
            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblRawDataCollectionFromReader);
            CustomCollection<TblRawData> objCollection = ((CustomCollection<TblRawData>)ExecuteReaderCmd(sqlCmd, test));

            return objCollection;
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static CustomCollection<TblRawData> GetAllTblRawDataPaged(String orderBy, Int32 startRowIndex, Int32 maximumRows)
        {
            //Validate Input
            if (orderBy == "")
                orderBy = "RawDataId";

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            AddParameterToSqlCmd(sqlCmd, "@orderby", SqlDbType.VarChar, 50, ParameterDirection.Input, orderBy);
            AddParameterToSqlCmd(sqlCmd, "@startrow", SqlDbType.Int, 0, ParameterDirection.Input, startRowIndex);
            AddParameterToSqlCmd(sqlCmd, "@pagesize", SqlDbType.Int, 0, ParameterDirection.Input, maximumRows);

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_GETALLTBLRAWDATAPAGED);

            GenerateCollectionFromReader test = new GenerateCollectionFromReader(GenerateTblRawDataCollectionFromReader);
            CustomCollection<TblRawData> objCollection = ((CustomCollection<TblRawData>)ExecuteReaderCmd(sqlCmd, test));
            return objCollection;
        }

        [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select, true)]
        public static int GetAllTblRawDataPagedCount(String orderBy, Int32 startRowIndex, Int32 maximumRows)
        {
            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();

            AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);
            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_GETALLTBLRAWDATAPAGEDCOUNT);
            ExecuteScalarCmd(sqlCmd);

            int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
            return returnValue;
        }

        #endregion
        #region Employee Instance Methods
        /************************************************************************************
                                    -- SAVE (INSERT/UPDATE) METHODS (INSTANCE) --
        *************************************************************************************/
        /// <summary>
        /// Saves (inserts and updates) an Employee into database.
        /// The insertion occur if the EmployeeId conatins default value.
        /// Otherwises it updates the Employee into the database, based on the primary key value stored in EmployeeId.
        /// This technique ensures an Employee will not be updated without having a valid EmployeeId.
        /// </summary>
        public bool Save()
        {
            if (RawDataId <= GetRawDataIdMinValue)
            {
                Int32 TempId = CreateNewTblRawData(this);
                if (TempId > 0)
                {
                    _rawDataId = TempId;
                    return true;
                }
                else
                {
                    // error occurs
                    return false;
                }
            }
            else
            {	//This is a update Command
                return (UpdateTblRawData(this));
            }

        }

        public static Int32 CreateNewTblRawData(TblRawData newTblRawData)
        {
            // validate Parameters
            if (newTblRawData == null)
                throw (new ArgumentNullException("newTblRawData"));

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            int length = 0;
            AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);

            AddParameterToSqlCmd(sqlCmd, "@ItemNumber", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.ItemNumber);
            AddParameterToSqlCmd(sqlCmd, "@QTYOnHand", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYOnHand);
            AddParameterToSqlCmd(sqlCmd, "@ItemDescription", SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblRawData.ItemDescription);
            AddParameterToSqlCmd(sqlCmd, "@CurrentCost", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.CurrentCost);
            AddParameterToSqlCmd(sqlCmd, "@StandardCost", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.StandardCost);
            AddParameterToSqlCmd(sqlCmd, "@Manufacturer", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.Manufacturer);
            AddParameterToSqlCmd(sqlCmd, "@PriceLevel", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.PriceLevel);
            AddParameterToSqlCmd(sqlCmd, "@PkgQuanity", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.PkgQuanity);
            AddParameterToSqlCmd(sqlCmd, "@SellingUOfM", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.SellingUOfM);
            AddParameterToSqlCmd(sqlCmd, "@ItemClassCode", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.ItemClassCode);
            AddParameterToSqlCmd(sqlCmd, "@QTYAllocated", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYAllocated);
            AddParameterToSqlCmd(sqlCmd, "@QTYAvailable", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYAvailable);
            AddParameterToSqlCmd(sqlCmd, "@QTYOnOrder", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYOnOrder);
            AddParameterToSqlCmd(sqlCmd, "@ItemGenericDescription", SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblRawData.ItemGenericDescription);
            AddParameterToSqlCmd(sqlCmd, "@ItemWeight", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.ItemWeight);
            AddParameterToSqlCmd(sqlCmd, "@ItemShortName", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.ItemShortName);
            AddParameterToSqlCmd(sqlCmd, "@IsInserted", SqlDbType.Bit, 0, ParameterDirection.Input, newTblRawData.IsInserted);
            AddParameterToSqlCmd(sqlCmd, "@WidthWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@WidthWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@WidthFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@WidthFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@SubCat1", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.SubCat1);
            AddParameterToSqlCmd(sqlCmd, "@DefaultOrder", SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblRawData.DefaultOrder);

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_CREATENEWTBLRAWDATA);
            ExecuteScalarCmd(sqlCmd);
            return (Int32.Parse(sqlCmd.Parameters["@ReturnValue"].Value.ToString()));

        }
        /// <summary>
        /// Updates an TblRawData instance to the database.
        /// </summary>
        public static bool UpdateTblRawData(TblRawData newTblRawData)
        {
            // validate Parameters
            if (newTblRawData == null)
                throw (new ArgumentNullException("newTblRawData"));

            // Execute SQL Command
            SqlCommand sqlCmd = new SqlCommand();
            int length = 0;
            AddParameterToSqlCmd(sqlCmd, "@ReturnValue", SqlDbType.Int, 0, ParameterDirection.ReturnValue, null);

            AddParameterToSqlCmd(sqlCmd, "@RawDataId", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.RawDataId);
            AddParameterToSqlCmd(sqlCmd, "@ItemNumber", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.ItemNumber);
            AddParameterToSqlCmd(sqlCmd, "@QTYOnHand", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYOnHand);
            AddParameterToSqlCmd(sqlCmd, "@ItemDescription", SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblRawData.ItemDescription);
            AddParameterToSqlCmd(sqlCmd, "@CurrentCost", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.CurrentCost);
            AddParameterToSqlCmd(sqlCmd, "@StandardCost", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.StandardCost);
            AddParameterToSqlCmd(sqlCmd, "@Manufacturer", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.Manufacturer);
            AddParameterToSqlCmd(sqlCmd, "@PriceLevel", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.PriceLevel);
            AddParameterToSqlCmd(sqlCmd, "@PkgQuanity", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.PkgQuanity);
            AddParameterToSqlCmd(sqlCmd, "@SellingUOfM", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.SellingUOfM);
            AddParameterToSqlCmd(sqlCmd, "@ItemClassCode", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.ItemClassCode);
            AddParameterToSqlCmd(sqlCmd, "@QTYAllocated", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYAllocated);
            AddParameterToSqlCmd(sqlCmd, "@QTYAvailable", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYAvailable);
            AddParameterToSqlCmd(sqlCmd, "@QTYOnOrder", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.QTYOnOrder);
            AddParameterToSqlCmd(sqlCmd, "@ItemGenericDescription", SqlDbType.NVarChar, 4000, ParameterDirection.Input, newTblRawData.ItemGenericDescription);
            AddParameterToSqlCmd(sqlCmd, "@ItemWeight", SqlDbType.Decimal, 9, ParameterDirection.Input, newTblRawData.ItemWeight);
            AddParameterToSqlCmd(sqlCmd, "@ItemShortName", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.ItemShortName);
            AddParameterToSqlCmd(sqlCmd, "@IsInserted", SqlDbType.Bit, 0, ParameterDirection.Input, newTblRawData.IsInserted);
            AddParameterToSqlCmd(sqlCmd, "@WidthWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@WidthWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@WidthFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@WidthFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.WidthFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@DiameterFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.DiameterFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@ThreadCountFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.ThreadCountFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthWholeNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthWholeNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthWholeNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthWholeNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthFractionNumberFirstDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthFractionNumberFirstDigit);
            AddParameterToSqlCmd(sqlCmd, "@LengthFractionNumberSecondDigit", SqlDbType.Int, 0, ParameterDirection.Input, newTblRawData.LengthFractionNumberSecondDigit);
            AddParameterToSqlCmd(sqlCmd, "@SubCat1", SqlDbType.NVarChar, 500, ParameterDirection.Input, newTblRawData.SubCat1);
            AddParameterToSqlCmd(sqlCmd, "@DefaultOrder", SqlDbType.NVarChar, 50, ParameterDirection.Input, newTblRawData.DefaultOrder);

            SetCommandType(sqlCmd, CommandType.StoredProcedure, SP_TBLRAWDATA_UPDATETBLRAWDATA);
            ExecuteScalarCmd(sqlCmd);
            int returnValue = (int)sqlCmd.Parameters["@ReturnValue"].Value;
            return (returnValue == 0 ? false : true);
        }
        #endregion

        #region TblRawData Related Collections
        /// <summary>
        /// Creates and returns a strongly typed collection of Employee custom entity. 
        /// The colelction is created through iterating on the IdataReader object which contains Employee information, as a set of records, similar to tabular format.
        /// </summary>
        public static CollectionBase GenerateTblRawDataCollectionFromReader(IDataReader returnData)
        {

            //creating the instance of Employee collection
            CustomCollection<TblRawData> colTblRawData = new CustomCollection<TblRawData>();

            /************************* Architecure note:**********************************
             * Below code includes the null value functionality to retieve the data which has nill value in database end.
             * Design consideration:
             * Besides general data fields, special care should be taken for primary keys, to assign '0'/defaultvalue, rather passing 'Null' value in constructor parameter.
             * Although we are considering sqldb tyoe data for the current data container, but while retireving data from database end, through datareader object, we need to cast data reader objects using .net primitive data type, 
             * rather using sqldb type to cast, since data reader objects don't support sql db type to be casted.
             *****************************************************************************/

            //Iterating thriugh the data reader, to generate Employee collection.

            //getting the Employee collection by iterating thru the data reader
            while (returnData.Read())
            {
                //passing the TblRawData constructor parameters from the current instance of data reader fields.
                TblRawData newTblRawData = new TblRawData
                (
                    returnData["RawDataId"] == System.DBNull.Value ? GetRawDataIdMinValue : (Int32)returnData["RawDataId"],
                    returnData["ItemNumber"] == System.DBNull.Value ? string.Empty : (String)returnData["ItemNumber"],
                    returnData["QTYOnHand"] == System.DBNull.Value ? 0 : (Int32)returnData["QTYOnHand"],
                    returnData["ItemDescription"] == System.DBNull.Value ? string.Empty : (String)returnData["ItemDescription"],
                    returnData["CurrentCost"] == System.DBNull.Value ? 0 : (Decimal)returnData["CurrentCost"],
                    returnData["StandardCost"] == System.DBNull.Value ? 0 : (Decimal)returnData["StandardCost"],
                    returnData["Manufacturer"] == System.DBNull.Value ? string.Empty : (String)returnData["Manufacturer"],
                    returnData["PriceLevel"] == System.DBNull.Value ? 0 : (Decimal)returnData["PriceLevel"],
                    returnData["PkgQuanity"] == System.DBNull.Value ? 0 : (Int32)returnData["PkgQuanity"],
                    returnData["SellingUOfM"] == System.DBNull.Value ? string.Empty : (String)returnData["SellingUOfM"],
                    returnData["ItemClassCode"] == System.DBNull.Value ? string.Empty : (String)returnData["ItemClassCode"],
                    returnData["QTYAllocated"] == System.DBNull.Value ? 0 : (Int32)returnData["QTYAllocated"],
                    returnData["QTYAvailable"] == System.DBNull.Value ? 0 : (Int32)returnData["QTYAvailable"],
                    returnData["QTYOnOrder"] == System.DBNull.Value ? 0 : (Int32)returnData["QTYOnOrder"],
                    returnData["ItemGenericDescription"] == System.DBNull.Value ? string.Empty : (String)returnData["ItemGenericDescription"],
                    returnData["ItemWeight"] == System.DBNull.Value ? 0 : (Decimal)returnData["ItemWeight"],
                    returnData["ItemShortName"] == System.DBNull.Value ? string.Empty : (String)returnData["ItemShortName"],
                    returnData["IsInserted"] == System.DBNull.Value ? false : (Boolean)returnData["IsInserted"],
                    returnData["WidthWholeNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["WidthWholeNumberFirstDigit"],
                    returnData["WidthWholeNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["WidthWholeNumberSecondDigit"],
                    returnData["WidthFractionNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["WidthFractionNumberFirstDigit"],
                    returnData["WidthFractionNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["WidthFractionNumberSecondDigit"],
                    returnData["DiameterWholeNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["DiameterWholeNumberFirstDigit"],
                    returnData["DiameterWholeNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["DiameterWholeNumberSecondDigit"],
                    returnData["DiameterFractionNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["DiameterFractionNumberFirstDigit"],
                    returnData["DiameterFractionNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["DiameterFractionNumberSecondDigit"],
                    returnData["ThreadCountWholeNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["ThreadCountWholeNumberFirstDigit"],
                    returnData["ThreadCountWholeNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["ThreadCountWholeNumberSecondDigit"],
                    returnData["ThreadCountFractionNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["ThreadCountFractionNumberFirstDigit"],
                    returnData["ThreadCountFractionNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["ThreadCountFractionNumberSecondDigit"],
                    returnData["LengthWholeNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["LengthWholeNumberFirstDigit"],
                    returnData["LengthWholeNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["LengthWholeNumberSecondDigit"],
                    returnData["LengthFractionNumberFirstDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["LengthFractionNumberFirstDigit"],
                    returnData["LengthFractionNumberSecondDigit"] == System.DBNull.Value ? 0 : (Int32)returnData["LengthFractionNumberSecondDigit"],
                    returnData["SubCat1"] == System.DBNull.Value ? string.Empty : (String)returnData["SubCat1"],
                    returnData["DefaultOrder"] == System.DBNull.Value ? string.Empty : (String)returnData["DefaultOrder"]

                );
                //adding the Employee to the collection
                colTblRawData.Add(newTblRawData);
            }

            //returns the collection of Companys 
            return (colTblRawData);
        }

        #endregion
        #region Constants and Default Values

        public static Int32 GetRawDataIdMinValue
        {
            get
            {
                return 0;
            }
        }

        //create method related contants
        internal const string SP_TBLRAWDATA_CREATENEWTBLRAWDATA = "sp_TblRawData_CreateNewTblRawData";
        internal const string SP_TBLRAWDATA_UPDATETBLRAWDATA = "sp_TblRawData_UpdateTblRawData";
        internal const string SP_TBLRAWDATA_DELETETBLRAWDATA = "sp_TblRawData_DeleteTblRawData";
        internal const string SP_TBLRAWDATA_DELETETBLRAWDATALIST = "sp_TblRawData_DeleteTblRawDataList";
        internal const string SP_TBLRAWDATA_GETTBLRAWDATABYRAWDATAID = "sp_TblRawData_GetTblRawDataByRawDataId";
        internal const string SP_TBLRAWDATA_GETALLTBLRAWDATA = "sp_TblRawData_GetAllTblRawData";
        internal const string SP_TBLRAWDATA_GETALLTBLRAWDATAPAGED = "sp_TblRawData_GetAllTblRawDataPaged";
        internal const string SP_TBLRAWDATA_GETALLTBLRAWDATAPAGEDCOUNT = "sp_TblRawData_GetAllTblRawDataPagedCount";

        #endregion
    }
}
